package com.wangs.controller;

import com.wangs.entity.Order;
import jakarta.validation.Valid;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/orders/")
public class OrderController {

    @PostMapping("save")
    public ResponseEntity<String> createOrder(@Valid @RequestBody Order order) {
        // 如果Order中的User信息不合法，请求将无法进入该方法
        return ResponseEntity.ok("订单创建成功");
    }
}
